﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Configuration;

namespace KioskosJugandoLimpio.Admin
{
    public partial class VideoList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["command"] == "delete")
            {
                if (Request.QueryString["guid"] != null)
                {
                    WebClient webC = new WebClient();
                    string pubKey = ConfigurationManager.AppSettings["publicNimbb"];
                    string privKey = ConfigurationManager.AppSettings["privateNimbb"];
                    string vidGuid = Request.QueryString["guid"];
                    Uri newUri = new Uri(string.Format("http://api.nimbb.com/Video/Delete.aspx?key={0}&code={1}&guid={2}", pubKey, privKey, vidGuid));
                    webC.UploadString(newUri, string.Empty);
                    int videoid = Classes.SQL.fnExec("EXEC delVideo '" + Request.QueryString["guid"] + "'");
                }
            }

        }
    }
}